package strongPasswordCheckerII;

public class Solutiob {
    static final String sepcealChar = "!@#$%^&*()-+";
    public boolean strongPasswordCheckerII(String password) {
        if(password.length()<8) return false;
        boolean oneLowrChar = false;
        boolean oneUpperChar = false;
        boolean oneNum = false;
        boolean special = false;
        for (int i = 0; i < password.length(); i++) {
            if(i!=0) {
                if(password.charAt(i) == password.charAt(i-1))
                    return false;
            }
            char c = password.charAt(i);
            if(c>='0'&&c<='9')oneNum = true;
            else if (c>='a'&&c<='z')oneLowrChar = true;
            else if (c>='A'&&c<='Z')oneUpperChar = true;
            else if (sepcealChar.contains(c+""))special = true;
        }
        return oneLowrChar&&oneUpperChar&&oneNum&&special;
    }
}
